package com.luboyan.CBillbill.util;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;

@Component
public class IOUtil {

    /**
     * 启动springboot时会同时启动这个方法
     */
//    @PostConstruct
    public static void start() {
        try {
            String command = "cmd /c start D:/code/java/java_web/C-billbill/start_plugin.bat";
            Process process = Runtime.getRuntime().exec(command);
            // 如果需要等待批处理执行完成，可以调用process.waitFor()
            int exitCode = process.waitFor();
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}
